package com.taoyibao.hongcanting.widget;

import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;

import com.taoyibao.hongcanting.R;
import com.taoyibao.hongcanting.base.BaseRelativeLayout;

/**
 * @author TangAnna
 * @description: 划掉的价格
 * @date :${DATA} 16:38
 */
public class HorizontalLineTextView extends BaseRelativeLayout<String> {
    private TextView mTextView;

    public HorizontalLineTextView(Context context) {
        super(context);
    }

    public HorizontalLineTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public HorizontalLineTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void initView(Context context, AttributeSet attrs, int defStyleAttr) {
        mTextView = findViewById(R.id.horizontal_line_text);
//        mTextView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//设置在中间加划线
        mTextView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);  // 设置中划线并加清晰
    }

    @Override
    public void setData(String data) {
        mTextView.setText(data);
    }

    @Override
    protected int bindLayout() {
        return R.layout.horizontal_line;
    }
}
